let app = getApp()
Component({
    properties: {
      list: {
        type:Object,
        observer: function(newVal, oldVal) {
          this.updateRate()
        }
      },
      initValue:{
        type:String,
        observer: function(newVal, oldVal) {
          this.updateinit()
        }
      },
    focusShowList: null,
    initValue: null,
    isCanInput: {
        type: Boolean,
        default: !1
    },
    selectHideType: {
        type: String,
        default: "hideAll"
    },
    placeholder: {
        type: String,
        default: "请选择"
    },
    option_style: {
        type: String,
        default: ""
    },
    style_Container: {
        type: String,
        default: ""
    },
    disabled: {
        type: Boolean,
        default: !1
    },
    showItemNum: {
        type: Number,
        default: 5
    },
    listShow: {
        type: Boolean,
        default: !1
    },
    clearable: {
        type: Boolean,
        default: !0
    },
    selectKey: {
        type: String,
        default: ""
    }
      },
      data:{
        isShowList: !1,
        selectText: "",
        activeIndex: -1,
        isRotate: !1,
        listTop__: 50
      },
    lifetimes: {
        attached: function () {
           
       }
      },
    methods: {
      changevalue:function(e){
        var index=e.currentTarget.dataset.index
        var op_name=e.currentTarget.dataset.op_name
        this.triggerEvent('changeselect',e.currentTarget.dataset.op_name)
        this.setData({
          activeIndex:index,
          selectText:op_name,
          isShowList:false,
          isRotate:false
        }) 
      },
      changeActiveIndex:function(){
        if(this.data.isShowList){
          this.setData({
            isShowList:false,
            isRotate:false
          })
        }else{
          this.setData({
            isShowList:true,
            isRotate:true
          })
        }
      },
      updateinit:function(){
      },
      updateRate:function(){
        var initValue=this.data.initValue
        this.setData({
          selectText:initValue
        })
      }
    }
});
